//
//  RGShareManager.m
//  RedGrass
//
//  Created by wuyine on 2019/2/18.
//  Copyright © 2019年 hongcaosp. All rights reserved.
//

#import "RGShareManager.h"



static RGShareManager *manager;
@implementation RGShareManager
+ (RGShareManager *)sharedInstance
{
    static dispatch_once_t once;
    dispatch_once(&once, ^{
        manager = [[RGShareManager alloc] init];
    });
    return manager;
}

//分享到其他客户端
- (void)shareWithPlatformType:(SSDKPlatformType)platformType onStateChanged:(doneblock)block {
    
    //创建分享参数
    NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
    /*
     分享图片时：
     *  设置type为SSDKContentTypeImage, 非gif图片时：填入title和image参数，如果为gif图片则需要填写title和emoticonData参数
     */
    [shareParams SSDKSetupWeChatParamsByText:nil
                                       title:@""
                                         url:nil
                                  thumbImage:nil
                                       image:IMAGE_NAMED(@"被邀请")
                                musicFileURL:nil
                                     extInfo:nil
                                    fileData:nil
                                emoticonData:nil
                         sourceFileExtension:nil
                              sourceFileData:nil
                                        type:SSDKContentTypeImage
                          forPlatformSubType:platformType];
    
    [ShareSDK share:platformType parameters:shareParams onStateChanged:^(SSDKResponseState state, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error) {
        block(state);
    }];
}
@end
